<template>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max='9'>
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input ref='numbox' class="mui-input-numbox" type="number" value="1" @change='numChange'/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</template>
<script>
    import mui from '../../lib/mui/js/mui.min.js'
    export default {
        mounted() {
            mui('.mui-numbox').numbox()
        },
        props: ['maxcount'],
        watch: {
            maxcount(newVal) {
                mui('.mui-numbox').numbox().setOption('max', newVal);
            }
        },
        methods:{
            numChange(){
               // var num= mui('.mui-numbox').numbox().getValue();
               var num=parseInt(this.$refs.numbox.value)

                this.$emit('getNum',num)
            }
        }
    }
</script>
<style lang="scss" scoped>
    .mui-numbox {
        height: 25px;
    }
</style>
